package com.example.tangjiangxu.dialogfragmentdemo;

import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button btnOpenDialog = (Button) findViewById(R.id.btn_open);
        btnOpenDialog.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                LoginDialogFragment loginFragmentDialog = new LoginDialogFragment();
                loginFragmentDialog.show(getFragmentManager(), "LoginDialog");
            }
        });
    }

    /**
     * 用户登录方法
     * @param name
     * @param pwd
     */
    public void login(String name, String pwd) {
        Toast.makeText(this, "name:" + name + "\npwd:" + pwd, Toast.LENGTH_LONG).show();
    }
}
